package com.syf.controller.RJController;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.syf.cmd.AuditIdCmd;
import com.syf.domain.store.BsCompanyAudit;
import com.syf.domain.store.BsSoftwareIncluded;
import com.syf.model.R;
import com.syf.service.BsSoftwareIncludedService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author syf
 * @create 2022-02-08 9:29
 */
@RestController
@RequestMapping("/included")
@Api(tags = "软件收录(审核)")
public class BsSoftwareIncludedController {

    @Autowired
    private BsSoftwareIncludedService bsSoftwareIncludedService;

    /**
     * 审核发布应用:【点击通过 -> 弹出选择软件分类】
     *      添加一个审核记录
     *      修改申请表(应用)状态
     */
    @PostMapping("/audit")
    @CrossOrigin
    @ApiOperation(value = "审核--应用发布列表")
    public R auditCompany(@RequestBody BsSoftwareIncluded bsSoftwareIncluded){
        boolean save = bsSoftwareIncludedService.auditSoftware(bsSoftwareIncluded);
        if(save){
            return R.ok("审核成功");
        }
        return  R.fail("审核失败");
    }



    @PostMapping("/includedDetails")
    @CrossOrigin
    @ApiOperation(value = "查看软件收录--审核详细")
    public R<BsSoftwareIncluded> includedDetails(@RequestBody AuditIdCmd auditIdCmd){
        return R.ok(bsSoftwareIncludedService.getById(auditIdCmd.getAuditId())) ;
    }

}
